<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
  [
    '<div contenteditable>',
      'foo bar <span contenteditable="false">baz</span>| qux quux',
    '</div>',
  ],
  selection => selection.modify('extend', 'backward', 'word'),
  [
    '<div contenteditable>',
      'foo bar |<span contenteditable="false">baz</span>^ qux quux',
    '</div>',
  ],
  '1 LTR extend backward word');

const kWord = '\u05E9\u05D5\u05BC\u05E8\u05D4';
selection_test(
  [
    '<div contenteditable>',
      `${kWord} ${kWord} `,
      `<span contenteditable="false">${kWord}</span>| ${kWord} ${kWord}`,
    '</div>',
  ],
  selection => selection.modify('extend', 'backward', 'word'),
  [
    '<div contenteditable>',
      `${kWord} ${kWord} |<span contenteditable="false">${kWord}</span>^ ${kWord} ${kWord}`,
    '</div>',
  ],
  '2 RTL extend backward word');
</script>
